//
//  Style.cpp
//  Chart
//
//  Created by Javen Wang on 5/29/13.
//
//

#include "YTXChartTools.h"
#include "YTXChartStyle.h"
#include <vector>

using namespace std;
ytx::Style::Style()
{
    avgLineType.push_back(avgValueColor);
    avgLineType.push_back(avgValueShadowColor);
    avgLineType.push_back(avgAVEColor);
    avgLineType.push_back("");
}

void ytx::Style::initIndexSetting()
{
    indexSettingSceneBackgroundColor = "#2A2E36";
    indexSettingSceneListItemHeight = 85*scaleFactor;
    indexSettingSceneListMarginLeft = 41*scaleFactor;
    indexSettingSceneListMarginRight = 41*scaleFactor;
    
    indexSettingSceneListItemIndexNameColor = "#666666";
    
    indexSettingSceneListItemSliderBallWidth =  30*scaleFactor;
    indexSettingSceneListItemSliderHeight = 30*scaleFactor;
    indexSettingSceneListItemHeaderSize = 18*scaleFactor;
    indexSettingSceneListItemTitleSize = 15*scaleFactor;
    indexSettingSceneListItemTitleColor = "#C9C9C9";
    indexSettingSceneListItemTitleFont = "VERDANA";
    indexSettingSceneListItemMarginTop =(indexSettingSceneListItemHeight - indexSettingSceneListItemTitleSize - indexSettingSceneListItemSliderHeight)/3;
    indexSettingSceneListItemMarginBottom = indexSettingSceneListItemMarginTop;
    
    indexSettingButtonHeight = indexTabbarHeight;
    indexSettingButtonWidth = 40*scaleFactor;
}

void ytx::Style::initIndexTabbar()
{
    indexTabbarSeparatorColor = "#07090C";
    indexTabbarSeparatorHeight = 1;
    
    indexTabbarMarginLeft = 15 * scaleFactor;
    indexTabbarTextSize = 13 * scaleFactor;
    indexTabbarTextFont = "VERDANA";
    indexTabbarWidth = 56*scaleFactor;
    indexTabbarHeight = 26*scaleFactor;
    indexTabbarSelectedColor = "#E8E8E8";
    indexTabbarDefaultColor = "#666666";
    indexTabbarBackgrounColor = "#31353D";
    indexTabbarIndicatorColor = "#FF6600";
}

void ytx::Style::initCrosshairs()
{
    coordinateColor = "#3A3F48";
    coordinateWidth = 1;
    
    crosshairsColor = "#E6FFFFFF";
    crosshairsWidth = 1;
    crosshairsTextColor = "#FFFFFF";
    crosshairsTextSize = 9 * scaleFactor;
    crosshairsTextRadius = 1.5 * scaleFactor;
    crosshairsTextFont = "VERDANA";
    crosshairsTextBackgorundColor = "#88FF0000";
    crosshairsTextLineColor = "#FFFFFF";
    crosshairsTextLineWidth = 1;
}

void ytx::Style::initAVGEconomicCalendar()
{
    AVGEconomicCalendarFillColorDefault = "#757575";
    AVGEconomicCalendarFillColorSelected = "#FF6600";
    AVGEconomicCalendarRadius = 7 * scaleFactor;
    AVGEconomicCalendarTextFont = 8 * scaleFactor;
    AVGEconomicCalendarTextColor = "#000000";
}

void ytx::Style::initInfoWindow()
{
    infoWindowLineWidth = 2;
    infoWindowLineColor = "#333232";
    infoWindowBackColor = "#333232";
    infoWindowTitleBackColor = "#333232";
    infoWindowColor = "#b3afaf";
}

void ytx::Style::initWarningLine()
{
    warningLineWidth = 3;
    warningLineColor = "#FFFFFF";
    warningLineRadius = 4.5 * scaleFactor;
    warningLineDashColor = "#00FDDC";
    warningLineDonutWidth = 3;
    warningLineDashWidthBig = 3;
    warningLineDashWidthSmall = 1;
    warningLineDashLength = 5;
    warningLineDashDistance = 1.5;
}

void ytx::Style::initIndexEconomicCalendar()
{
    IndexEconomicCalendarDefaultTextSize = 15 * scaleFactor;
    IndexEconomicCalendarDefaultTextColor = "#666666";
    IndexEconomicCalendarDefaultTextFont = "VERDANA";
    
    IndexEconomicCalendarECTimeTextSize = 11 * scaleFactor;
    IndexEconomicCalendarECTimeTextColor = "#666666";
    IndexEconomicCalendarECTimeTextFont = "VERDANA";
    
    IndexEconomicCalendarECTitleTextSize = 13 * scaleFactor;
    IndexEconomicCalendarECTitleTextColor = "#C9C9C9";
    IndexEconomicCalendarECTitleTextFont = "VERDANA";
    
    IndexEconomicCalendarECValueTextSize = 11 * scaleFactor;
    IndexEconomicCalendarECValueTextColor = "#C9C9C9";
    IndexEconomicCalendarECValueTextFont = "VERDANA";
}

void ytx::Style::initTabbar()
{
    
    tabbarBackgroundColor = "#1F222A";
    tabbarDefaultColor = "#757575";
    tabbarSelectedColor = "#FF6600";
    tabbarTextFont = "VERDANA";
    tabbarIndicatorColor = "#FF6600";
    
    tabbarIndicatorWidth = 2 * scaleFactor;
    
    tabbarTextSize = 15 * scaleFactor;
    tabbarWidth = 50 * scaleFactor;
    tabbarHeight = 50 * scaleFactor;
}

void ytx::Style::initQKType()
{
    QKTypeBackgroundLong = "#26fb5056";
    QKTypeBackgroundShort = "#3A26e8a9";
    QKTypeBackgroundFlat = "#26adadad";
    
    QKTypeLong = "#fb5056";
    QKTypeShort = "#26e8a9";
    QKTypeFlat = "#adadad";
    
    QKTypeLast = "#fcff00";
}

void ytx::Style::initQKTType()
{
    QKTTypeBackgroundLong = "#26ff0009";
    QKTTypeBackgroundShort = "#26007ade";
    QKTTypeBackgroundFlat = "#26adadad";
    
    QKTTypeLong = "#fb5056";
    QKTTypeShort = "#26e8a9";
    QKTTypeFlat = "#adadad";
    
    QKTTypeLast = "#fcff00";
}

void ytx::Style::initGameMatrixType()
{
    GameMatrixTypeBackgroundLong = "#7F302026";
    GameMatrixTypeBackgroundShort = "#7F1C2D23";
    
    GameMatrixTypeBoundLong = "#302026";
    GameMatrixTypeBoundShort = "#0E4C13";
    
    GameMatrixTopTextColor = "#FFFFFF";
    
    GameMatrixKLineTypeLong = "#E32616";
    GameMatrixKLineTypeShort = "#22B521";
    
    GameMatrixTriangleVertexTypeLong = "#E32616";
    GameMatrixTriangleVertexTypeShort = "#22b521";
    
    GameMatrixTypeBackgroundLineLong  = "#9E0B0B";
    GameMatrixTypeBackgroundLineShort = "#036D0C";

}

void ytx::Style::initHJJTType()
{
    HJJTTypeUpBackground = "#dc2424";
    HJJTTypeDownBackground = "#1d976c";
    HJJTTypeUpLightBackground = "#00ffffff";
    HJJTTypeDownLightBackground = "#00ffffff";
}

void ytx::Style::initBuyLine()
{
    buyLineWidth = 0.5;
    buyLineColor = "#F54337";
    buyPointTextSize = 10 * scaleFactor;
    buyPointTextColor = "#F54337";
}

void ytx::Style::init(float scaleFactor)
{
    this->scaleFactor = scaleFactor;
    
    kLineHighLowColor = "#FFFFFF";
    
    canvaserLayerColor = "#313030";
    
    remindLayerColor= "#CC0F0F0F";
    
    indexLayerColor= "#31353d";
    
    mainViewProportion = 3;
    //附图的比例
    minorViewProportion = 1;
    
    initIndexTabbar();
    initIndexSetting();
    initCrosshairs();

    
    avgValueColor = "#FF6600";
    avgUpDropColor = "#FF6600";
    avgPercentColor = "#FF6600";
    avgValueName = "最新";
    avgValueShadowColor = "#802887ee";
    isAvgValueShadowColor = false;
    avgAVEColor = "#95AE00";
    avgAVEName = "均价";
    avgOfVolumeName = "量";
    avgOfVolumeColor = "#38699B";
    
    //背景色
    backColor = "#FFFFFF";
    //矩形框内背景色
    rectColor = "#FFFFFF";
    backLineColor = "#333232";
    backLineWidth = 1;

    defaultGreen = "#33FF33";
    defaultRed = "#FF2D19";
    defaultWhite = "#FFFFFF";

    font = "VERDANA";

    hollow = "#FBF807";
    isLineShadow = false;

    kSidePercentColor = "#fa0000";
    kSidePercentFont = "VERDANA";
    kSidePercentSize = 8 * scaleFactor;
    kSidePercentLineWidth = 8;

    percentcolumn = "#30F455";

    quoteLineWidth = 1;

    rectLineColor = "#3A3F48";
    rectLineWidth = 1;
    rectangleWidthPercent = 0.8;
    rectangleHeightPercent = 0.826;
    remaindLineColor = "#94989b";
    remaindTextColor = "#E92925";
    remaindTextFont = "VERDANA";
    remaindTextSize = "30px";
    remaindWidth = 1.5f;

    sideTextColor = "#FFFFFF";
    sideTextAccuracy = 8 * scaleFactor;
    size = 8 * scaleFactor;

    timeRangeColor = "#666666";
    timeRangeSize = 8 * scaleFactor;
    titleColor = "#222222";
    textColor = "#225299";
    startColor = 0xF4D5E9FF;
    endColor = 0x33DEEDFF;
    dashLineLength = 15;
    dashLineDistance = 5;
    
    rectPaddingTop = 0;
    rectPaddingBottom = 0;
    rectPaddingLeft = 4;
    rectPaddingRight = 4;

    initInfoWindow();

    initWarningLine();
    
    initBuyLine();

    TJFillColorTop = "#2632FA32";
    TJFillColorBottom = "#25F91400";
    
    initAVGEconomicCalendar();
    
    initIndexEconomicCalendar();
    
    initTabbar();
    
    initQKType();
    
    initQKTType();
    
    initGameMatrixType();

    initHJJTType();
    
    topSideTextLeftMargin = 5;
    
    userPaintDefaultColor = "#FFFF00";
    
}
